package com.qingchi.web.config;

import com.qingchi.web.config.filter.UserAuthInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class CorsConfig implements WebMvcConfigurer {
    /*@Resource
    private UserControllerArgumentResolver userControllerArgumentResolver;*/

  /*  @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
//        argumentResolvers.add(userControllerArgumentResolver);
//        argumentResolvers.add(devIdControllerArgumentResolver);
//        argumentResolvers.add(devNumControllerArgumentResolver);
//        argumentResolvers.add(devAppGenderControllerArgumentResolver);
    }*/

    @Resource
    private UserAuthInterceptor userAuthInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 自定义拦截器，添加拦截路径和排除拦截路径
        registry.addInterceptor(userAuthInterceptor).addPathPatterns("/**");
    }
}